<?php

namespace App\Http\Resources\Agent;

use Illuminate\Http\Resources\Json\ResourceCollection;

class AgentSliderCollection extends ResourceCollection
{
    /**
     * Transform the resource collection into an array.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return array
     */
    public function toArray($request)
    {
        return [
            'code'=>0,
            'data'=>$this->collection->map(function($item){
                return [
                    'image'=>\Storage::url($item->name),
                    'url'=>$item->url
                ];
            })
        ];
    }
}
